
function hideTds() {
    var tds = document.querySelectorAll('td');
    for (var i = 0; i < 10; i++) {
        tds[i].style.display = 'none';
    }
    $('.kuaisu').hide();
}
hideTds();
document.querySelector('#se_is').onkeyup = function() {
    var tds = document.querySelectorAll('td');
    for (var i = 0; i < 10; i++) {
        tds[i].innerHTML = '';
    }
    hideTds();
    if (this.value.trim() === '') {
        return;
    }

    var s = document.createElement('script');
    s.className='ss';
    s.src = 'http://unionsug.baidu.com/su?wd=' + encodeURI(this.value.trim()) + '&p=3&cb=fn';
    document.body.appendChild(s);
    $('.kuaisu').show();

};
function fn(data) {
    var tds = document.querySelectorAll('td');
    data.s.forEach(function(item, index) {
        tds[index].style.display = '';
        tds[index].innerHTML = item;
    });
    $('.ss').remove();

}
document.querySelector('tbody').onclick = function(e) {
    var wd = e.target.innerHTML;
    window.open('https://www.baidu.com/s?word=' + encodeURI(wd));
};
document.onclick = function(e) {
        if (e.target === document.body) {
            hideTds();
        }
    }
